/**
 * 添加商品介绍内容DTO
 */
export default class GoodProduceInsertDTO {
  static instance () {
    return new GoodProduceInsertDTO()
  }

  setGoodId (goodId) {
    if (goodId) {
      this.goodId = goodId
    }
  }

  setContentType (contentType) {
    if (contentType) {
      this.contentType = contentType
    }
  }

  setContent (content) {
    if (content) {
      this.content = content
    }
  }

  setLinkGoodId (linkGoodId) {
    if (linkGoodId) {
      this.linkGoodId = linkGoodId
    }
  }

  setLinkSubGoodId (linkSubGoodId) {
    if (linkSubGoodId) {
      this.linkSubGoodId = linkSubGoodId
    }
  }

  setLinkUrl (linkUrl) {
    if (linkUrl) {
      this.linkUrl = linkUrl
    }
  }

  setSortNumber (sortNumber) {
    if (sortNumber) {
      this.sortNumber = sortNumber
    }
  }

  setRemark (remark) {
    if (remark) {
      this.remark = remark
    }
  }

  /**
   * 将本DTO转换成FormData数据
   * @return {FormData}
   */
  toFormData () {
    const formDate = new FormData()
    if (this.goodId) {
      formDate.append('goodId', this.goodId)
    }
    if (this.contentType) {
      formDate.append('contentType', this.contentType)
    }
    if (this.content) {
      formDate.append('content', this.content)
    }
    if (this.linkGoodId) {
      formDate.append('linkGoodId', this.linkGoodId)
    }
    if (this.linkSubGoodId) {
      formDate.append('linkSubGoodId', this.linkSubGoodId)
    }
    if (this.linkUrl) {
      formDate.append('linkUrl', this.linkUrl)
    }
    if (this.sortNumber) {
      formDate.append('sortNumber', this.sortNumber)
    }
    if (this.remark) {
      formDate.append('remark', this.remark)
    }
    return formDate
  }
}
